#!/bin/bash

# Generates the files were the possiblePredicate is true when the word is a SRL predicate 

USAGE="
    Usage: tranlatecorpora2conll08 [options]]\n
    -a      No ask for confirmation\n
    -help   Print this"

opts=" -v -G --possible_ON --mst_conll08 "
#opts=" -v -H -G -f johanson --possible_ON --mst_conll08 "

if [ $# -gt 1 ]
then
    echo -n $USAGE
    exit 1;
fi

CONFIRM=1
if [ $# -eq 1 ]
then
    case $1 in
        "-a"     ) CONFIRM=0;;
        *        ) echo -e $USAGE;exit 1;;
    esac 
fi

# Commandline to transform conll08 corpus into the beast corpus
echo "
creates the following corpora:
 devel.closed -> devel_propbank.closed.atoms & devel_propbank.closed.types.pml
 train.closed -> train_propbank.closed.atoms & train_propbank.closed.types.pml
"



if [ $CONFIRM -eq 0 ]
then
    ANS="yes"
else
    echo -n "translate open test.wsj ? (yes/[no]) "
    read -e ANS
fi

if [ -z $ANS ]
then
    ANS="no"
fi

if [ $ANS = "yes" ]
then
    set -x
    nice bin/conll082beast.py ${opts}  -8  data/conll08_submissions/johansson.wsj.closed.complete.conll08 -d data/conll05/test_wsj_propbank.types.pml -o  data/conll05/test_wsj_propbank.atoms -M data/conll08_submissions/johansson.wsj.closed.complete data/conll05/test_wsj_propbank.output
    set +x
fi


if [ $CONFIRM -eq 0 ]
then
    ANS="yes"
else
    echo -n "translate open test.brown ? (yes/[no]) "
    read -e ANS
fi

if [ -z $ANS ]
then
    ANS="no"
fi

if [ $ANS = "yes" ]
then
    set -x
    nice bin/conll082beast.py ${opts} -8 data/conll08_submissions/johansson.brown.closed.complete.conll08 -d data/conll05/test_brown_propbank.types.pml -o data/conll05/test_brown_propbank.atoms -M data/conll08_submissions/johansson.brown.closed.complete  data/conll05/test_brown_propbank.output
    set +x
fi

